package com.example.cloud.alibaba.seata.order.controller;

import com.example.cloud.alibaba.seata.common.dto.OrderDTO;
import com.example.cloud.alibaba.seata.common.utils.SimpleMessage;
import com.example.cloud.alibaba.seata.order.service.ITOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 订单服务
 * </p>
 * <p>
 * * @author lidong
 *
 * @since 2019-09-04
 */
@RestController
@RequestMapping("/order")
@Slf4j
public class TOrderController {


    @Autowired
    private ITOrderService orderService;

    @PostMapping("/create_order")
    SimpleMessage<OrderDTO> createOrder(@RequestBody OrderDTO orderDTO) {
        log.info("请求订单微服务：{}", orderDTO.toString());
        return orderService.createOrder(orderDTO);
    }

    @GetMapping("/test/{path}")
    SimpleMessage testAccount(@PathVariable("path") String path) {
        log.info("远程微服务调用测试:订单——>账号");
        return orderService.testAccount(path);
    }
}

